<template>
    <div class="body">
        <div class="hg_title">
            <div></div>
            <dl @click="turnBlank(1, { categoryId: icur })">
                <dd>动态信息</dd>
                <dt>INFORMATION</dt>
            </dl>
            <div></div>
        </div>
        <div class="hg_newbox">
            <div class="hg_newboxrig">
                <img
                    class="hg_newboxrigimg"
                    src="~/assets/img/hg/hg_kjgl.png"
                    alt=""
                />
                <img
                    class="hg_newboxrigimg"
                    src="~/assets/img/hg/hg_txl.png"
                    alt=""
                />

                <div class="hg_newboxr_wrap">
                    <div class="hg_nbrw_top">
                        <i></i>
                        <span>下载专区</span>
                        <i></i>
                    </div>

                    <ul class="hg_nbrw_ul">
                        <li>
                            <img
                                src="~/assets/img/hg/hg_gwcl.png"
                                alt=""
                            />
                            <p>公文处理</p>
                        </li>
                        <li>
                            <img
                                src="~/assets/img/hg/hg_pxcl.png"
                                alt=""
                            />
                            <p>培训材料</p>
                        </li>
                    </ul>
                </div>
            </div>

            <div class="hg_newboxlef">
                <div class="hg_boxct_nav">
                    <div class="hg_boxct_navdiv">
                        <ul class="hg_boxt_ul">
                            <li
                                :class="{
                                    hg_boxt_ulli_active:
                                        icur === '3402878483279487003',
                                }"
                                @click="turnNav('3402878483279487003', $event)"
                            >
                                <h1>科技信息快报</h1>
                                <p></p>
                            </li>
                            <li
                                :class="{
                                    hg_boxt_ulli_active:
                                        icur === '3403059822174721065',
                                }"
                                @click="turnNav('3403059822174721065', $event)"
                            >
                                <h1>党建工作</h1>
                                <p></p>
                            </li>
                        </ul>

                        <div
                            class="hg_boxt_more"
                            @click="turnBlank(1, { categoryId: icur })"
                        >
                            <img
                                src="@/assets/img/hg/icon_arrow_right.png"
                                alt=""
                            />
                            <span>更多</span>
                        </div>
                    </div>
                </div>

                <div class="hg_boxct_navclear"></div>

                <div
                    v-for="(item, index) in dataList"
                    :key="index"
                    @click="turnBlank(2, { typeId: item.typeId, id: item.id })"
                    class="hg_liclass"
                    :class="{ hg_active: index === icurli }"
                    @mouseover="icurli = index"
                    @mouseleave="icurli = 0"
                >
                    <div class="hg_boxchildtop">
                        <div>
                            <div class="hg_boxct_lef">
                                <img
                                    :src="
                                        item.cmsFile[0]
                                            ? item.cmsFile[0].path
                                            : require('@/assets/img/hg/bannerceshi.png')
                                    "
                                    alt=""
                                />
                            </div>
                            <div class="hg_boxct_rig">
                                <h1>
                                    {{ item.name }}
                                </h1>
                                <h2>
                                    <img
                                        src="@/assets/img/hg/icon_time.png"
                                        alt=""
                                    /><span>{{ item.publishTime }}</span>
                                </h2>
                                <h3>
                                    {{ item.cmsArticle.content }}
                                </h3>
                            </div>
                        </div>
                    </div>

                    <div class="hg_boxlist">
                        <a>
                            <i></i>
                            <span>{{ item.name }}</span>
                            <b>{{ item.publishTime }}</b>
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
import appUtil from '~/assets/utils/appUtil';
import { createNamespacedHelpers } from 'vuex';
const { mapActions } = createNamespacedHelpers('hgModule');
export default {
    name: 'test',
    data() {
        return {
            icurli: 0,
            dataList: [],
            icur: '3402878483279487003',
            title: '科技信息快报',
        };
    },
    mounted() {
        this.getdataList(1, 4, this.icur);
    },
    methods: {
        ...mapActions(['getdataListsAsync']),
        turnNav(icurid, e) {
            this.title = e.target.innerHTML;
            this.icur = icurid;
            this.getdataList(1, 4, this.icur);
        },
        turnBlank(type, Parameters) {
            appUtil.routerUrl(type, Parameters, this.title, this.icur);
        },
        getdataList(pn, ps, categoryId) {
            this.getdataListsAsync({
                pn,
                ps,
                categoryId,
            }).then((res) => {
                this.dataList = res.data.dataList;
                for (let i = 0; i < this.dataList.length; i++) {
                    if (this.dataList[i].cmsArticle) {
                        this.dataList[
                            i
                        ].cmsArticle.content = appUtil.strIntercept(
                            this.dataList[i].cmsArticle.content
                        );
                    }
                }
            });
        },
    },
};
</script>

<style lang="scss" scoped>
.body {
    overflow: hidden;
    width: 1200px;
    margin: 0 auto;
}

.hg_title {
    width: 100%;
    min-width: 1200px;
    height: 56px;
    margin: 20px auto 0;

    div {
        width: 44%;
        height: 8px;
        background: #d8d8d8;
        border-radius: 2px;
        opacity: 0.3;
        float: left;
        margin-top: 18px;
    }

    dl {
        float: left;
        width: 12%;
        text-align: center;
        cursor: pointer;

        dd {
            font-size: 28px;
            font-weight: bold;
            color: #094194;
        }

        dt {
            font-size: 18px;
            font-weight: bold;
            color: #094194;
            opacity: 0.2;
            margin-top: -6px;
        }
    }
}

.hg_newbox {
    width: 100%;
    .hg_liclass {
        overflow: hidden;
        .hg_boxchildtop {
            display: none;
        }
        .hg_boxlist {
            display: block;
        }
    }
    .hg_newboxlef {
        margin-right: 358px;

        .hg_active {
            .hg_boxchildtop {
                display: block;
            }
            .hg_boxlist {
                display: none;
            }
        }

        .hg_boxct_nav {
            height: 62px;

            .hg_boxct_navdiv {
                height: 48px;
                border-bottom: 6px solid rgba(216, 216, 216, 0.5);
                line-height: 48px;
            }

            .hg_boxt_ul {
                float: left;

                .hg_boxt_ulli_active {
                    h1 {
                        font-size: 18px;
                        font-weight: 600;
                        color: #094194;
                    }

                    p {
                        display: block;
                    }
                }

                li {
                    float: left;
                    margin-left: 20px;
                    cursor: pointer;

                    h1 {
                        font-size: 16px;
                        font-weight: 400;
                        color: #666666;
                    }

                    p {
                        background: url('~/assets/img/hg/icon_line.png')
                            center top no-repeat;
                        background-size: 111px 9px;
                        height: 10px;
                        display: none;
                    }
                }
            }

            .hg_boxt_more {
                float: right;
                line-height: 48px;
                cursor: pointer;

                img {
                    float: right;
                    margin: 16px 5px 0 5px;
                }

                span {
                    float: right;
                }
            }
        }

        .hg_boxchildtop {
            height: 168px;
            background: #f7f7f7;
            border-radius: 4px;
            padding: 0 20px;
            margin-top: 10px;

            .hg_boxct_lef {
                float: left;
                width: 20%;
                height: 164px;
                overflow: hidden;
                img {
                    height: 100%;
                }
            }

            .hg_boxct_rig {
                width: 75%;
                float: left;
                margin-left: 3%;
                cursor: pointer;
                h1 {
                    font-size: 20px;
                    font-weight: 600;
                    color: #333333;
                    line-height: 35px;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    white-space: nowrap;
                    padding-right: 10px;
                }

                h2 {
                    font-size: 12px;
                    color: #aaa;
                    font-weight: normal;
                    height: 20px;
                    line-height: 20px;
                    margin: 11px auto;

                    img {
                        float: left;
                        margin: 4px 5px 0 2px;
                    }

                    span {
                        float: left;
                    }
                }

                h3 {
                    font-size: 14px;
                    font-weight: 400;
                    color: #555555;
                    line-height: 24px;

                    a {
                        font-size: 10px;
                        font-weight: 400;
                        color: #094191;
                        line-height: 26px;
                        float: right;
                    }
                }
            }
        }

        .hg_boxlist {
            padding: 0 20px;
            a {
                width: 100%;
                display: inline-block;
                border-bottom: 1px solid #eaeaea;
                height: 39px;
                line-height: 39px;
                cursor: pointer;

                i {
                    float: left;
                    width: 4px;
                    height: 4px;
                    background: #999999;
                    border-radius: 2px;
                    margin: 21px 10px 0 5px;
                }

                span {
                    float: left;
                    font-size: 14px;
                    font-weight: 400;
                    color: #333333;
                    max-width: 75%;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    white-space: nowrap;
                }

                b {
                    float: right;
                    font-size: 14px;
                    font-weight: 400;
                    color: #666666;
                    margin-right: 20px;
                }
            }
        }
    }

    .hg_newboxrig {
        float: right;
        width: 338px;

        .hg_newboxrigimg {
            margin: 0 auto;
            display: block;
            margin-top: 5px;
        }

        .hg_newboxr_wrap {
            width: 320px;
            margin: 0 auto;
            height: 160px;
            border: 1px solid #2c8bff;
            margin-top: 5px;
        }

        .hg_nbrw_ul {
            width: 100%;
            height: 100%;
            padding: 0 10px;

            li {
                float: left;
                text-align: center;
                padding: 0 42px;

                p {
                    font-size: 14px;
                    font-weight: 400;
                    color: #094194;
                    margin-top: 14px;
                }

                img {
                    margin-top: 22px;
                }
            }
        }

        .hg_nbrw_top {
            height: 30px;
            background: #094194
                linear-gradient(180deg, #0089ff 0%, #032795 100%);
            border-radius: 1px;
            text-align: center;
            line-height: 30px;

            span {
                font-size: 14px;
                font-weight: 400;
                color: #ffffff;
                margin: 0 10px;
            }

            i {
                display: inline-block;
                width: 4px;
                height: 4px;
                background: #ffffff;
                border-radius: 2px;
            }
        }
    }
}
</style>
